#include "BlazeEngineColor.h"


BeColor::BeColor()
{

}

BeColor::BeColor(unsigned int uiA, unsigned int uiR, unsigned int uiG, unsigned int uiB) : 
	m_uiColor(((uiA & 0xFF) << 24) | ((uiR & 0xFF) << 16) | ((uiG & 0xFF) << 8) | (uiB & 0xFF)) 
{
	SetAlpha(uiA);
	SetRed(uiR);
	SetGreen(uiG);
	SetBlue(uiB);
}

BeColor::BeColor(unsigned int uiColor) : 
	m_uiColor(uiColor) 
{
	a = (float)GetAlpha() / 255.0f;
	r = (float)GetRed() / 255.0f;
	g = (float)GetGreen() / 255.0f;
	b = (float)GetBlue() / 255.0f;
}

BeColor::~BeColor()
{

}

void BeColor::SetColor(unsigned int uiA, unsigned int uiR, unsigned int uiG, unsigned int uiB)
{
	m_uiColor = (((uiA & 0xFF) << 24) | ((uiR & 0xFF) << 16) | ((uiG & 0xFF) << 8) | (uiB & 0xFF));

	a = (float)GetAlpha() / 255.0f;
	r = (float)GetRed() / 255.0f;
	g = (float)GetGreen() / 255.0f;
	b = (float)GetBlue() / 255.0f;
}

void BeColor::SetColor(unsigned int uiColor)
{ 
	m_uiColor = uiColor; 
}

void BeColor::SetAlpha(unsigned int uiA)
{ 
	m_uiColor = ((uiA & 0xFF) << 24) | (m_uiColor & 0x00FFFFFF);
	a = (float)uiA / 255.0f;
}

void BeColor::SetRed(unsigned int uiR)
{ 
	m_uiColor = ((uiR & 0xFF) << 16) | (m_uiColor & 0xFF00FFFF);
	r = (float)uiR / 255.0f;
}

void BeColor::SetGreen(unsigned int uiG)
{ 
	m_uiColor = ((uiG & 0xFF) << 8) | (m_uiColor & 0xFFFF00FF);
	g = (float)uiG / 255.0f;
}

void BeColor::SetBlue(unsigned int uiB)
{ 
	m_uiColor = (uiB & 0xFF) | (m_uiColor & 0xFFFFFF00);
	b = (float)uiB / 255.0f;
}

unsigned int BeColor::GetColor()
{
	return m_uiColor;
}

unsigned int BeColor::GetAlpha()
{ 
	return m_uiColor >> 24; 
}

unsigned int BeColor::GetRed()
{ 
	return (m_uiColor >> 16) & 0xFF;
}

unsigned int BeColor::GetGreen()
{ 
	return (m_uiColor >> 8) & 0xFF;
}

unsigned int BeColor::GetBlue()
{ 
	return m_uiColor & 0xFF;
}

